package com.zhichat.infrastructure.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName: ContactStatusEnum
 * @Description: 联系人状态 枚举
 * @Author: 团长九哥 https://space.bilibili.com/602197686
 * @CreateDate: 2024/11/14 22:25
 */
@Getter
@AllArgsConstructor
public enum ContactStatusEnum {
    NON_FRIEND(1, "非好友"),
    FRIEND(2, "好友"),
    DELETED_FRIEND(3, "已删除好友"),
    DELETED_BY_FRIEND(4, "被好友删除"),
    BLACKLIST_FRIEND(5, "已拉黑好友"),
    BLACKLISTED_BY_FRIEND(6, "被好友拉黑");
    private final Integer code;
    private final String desc;

    public static ContactStatusEnum getEnumByCode(Integer code) {
        for (ContactStatusEnum statusEnum : ContactStatusEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
